import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class day230427 {
    // 收件人列表
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            in.nextLine();
            List<String> list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                String str = in.nextLine();
                if (str.contains(",") || str.contains(" ")) {
                    list.add("\"" + str + "\"");
                } else {
                    list.add(str);
                }
            }
            System.out.println(String.join(", ", list));
        }
    }

    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            in.nextLine(); // 吃掉换行
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < n; i++) {
                String s = in.nextLine();
                if (s.indexOf(' ') + s.indexOf(',') != -2) {
                    sb.append('"');
                    sb.append(s);
                    sb.append('"');
                } else {
                    sb.append(s);
                }
                if (i != n - 1) {
                    sb.append(", ");
                }
            }
            System.out.println(sb);
        }
    }

    // 养兔子
    public static void main1(String[] args) {
        long[] arr = new long[90];
        arr[0] = 1;
        arr[1] = 2;
        for (int i = 2; i < 90; i++) {
            arr[i] = arr[i - 2] + arr[i - 1];
        }
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            System.out.println(arr[n - 1]);
        }
    }
}
